#coding=utf8

import urllib

def main():
    rp = {'z':'3','m':'4','k':'2','l':"9",'d':'0','b':'5','i':'7','w':'6','r':'8','c':'1'}
    for i in xrange(1,11):
        url = 'http://www.cnproxy.com/proxy%d.html'%i
        f = urllib.urlopen(url)
        r = f.readlines()
        for l in r:
            if l[:8] == '<tr><td>':
                idx = l.find('<SCRIPT')
                print l[8:idx],
                idx2 = l.find('</SCRIPT>')
                port = l[idx+48:idx2-1].replace("+","")
                for k,v in rp.items():
                    port = port.replace(k,v)
                print port


if __name__ == '__main__':
    main()

